package com.restaurant.application.reservation.support;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.UID;

import java.util.List;

public class ReservationData implements PickableBean {

    public static final String FN_ID = "id";
    public static final String FN_CREATETIME = "createTime";
    public static final String FN_MODIFYTIME = "modifyTime";
    public static final String FN_NUMBER = "number";
    public static final String FN_SHOPUID = "shopUid";
    public static final String FN_SHOPNAME = "shopName";
    public static final String FN_SERVICENAME = "serviceName";
    public static final String FN_PERSONAMOUNT = "personAmount";
    public static final String FN_DATE = "date";
    public static final String FN_TIME = "time";
    public static final String FN_CUSTOMERID = "customerId";
    public static final String FN_CUSTOMERUID = "customerUid";
    public static final String FN_CUSTOMERNAME = "customerName";
    public static final String FN_PHONE = "phone";
    public static final String FN_REMARKS = "remarks";
    public static final String FN_STATE = "state";

    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_ID,
             FN_CREATETIME,
             FN_MODIFYTIME,
             FN_NUMBER,
             FN_SHOPUID,
             FN_SHOPNAME,
            FN_SERVICENAME,
             FN_PERSONAMOUNT,
            FN_DATE,
            FN_TIME,
             FN_CUSTOMERID,
             FN_CUSTOMERUID,
             FN_CUSTOMERNAME,
             FN_PHONE,
             FN_REMARKS,
            FN_STATE);

    private String id;
    private Long createTime;
    private Long modifyTime;
    private String number;
    private UID shopUid;
    private String shopName;
    private String serviceName;
    private Integer personAmount;
    private Long date;
    private String time;
    private String customerId;
    private UID customerUid;
    private String customerName;
    private String phone;
    private String remarks;
    private String state;

    public ReservationData(String id, Long createTime, Long modifyTime, String number, UID shopUid, String shopName, String serviceName, Integer personAmount, Long date, String time, String customerId, UID customerUid, String customerName, String phone, String remarks, String state) {
        setId(id);
        setCreateTime(createTime);
        setModifyTime(modifyTime);
        setNumber(number);
        setShopUid(shopUid);
        setShopName(shopName);
        setServiceName(serviceName);
        setPersonAmount(personAmount);
        setDate(date);
        setTime(time);
        setCustomerId(customerId);
        setCustomerUid(customerUid);
        setCustomerName(customerName);
        setPhone(phone);
        setRemarks(remarks);
        setState(state);
    }

    public ReservationData() {
    }

    public ReservationData duplicate() {
        ReservationData result = new ReservationData();
        result.id = this.id;
        result.createTime = this.createTime;
        result.modifyTime = this.modifyTime;
        result.number = this.number;
        result.shopUid = this.shopUid;
        result.shopName = this.shopName;
        result.serviceName = this.serviceName;
        result.personAmount = this.personAmount;
        result.date = this.date;
        result.time = this.time;
        result.customerId = this.customerId;
        result.customerUid = this.customerUid;
        result.customerName = this.customerName;
        result.phone = this.phone;
        result.remarks = this.remarks;
        result.state = this.state;
        return result;
    }

    @Override
    public String toString() {
        return Convert.toJson(this);
    }

    public String getId() {
        return id;
    }

    public void  setId(String value) {
        this.id = value;
    }

    public ReservationData withId(String value) {
        setId(value);
        return this;
    }

    public ReservationData withId(String value, String defaultValue) {
        setId(value == null ? defaultValue : value);
        return this;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void  setCreateTime(Long value) {
        this.createTime = value;
    }

    public ReservationData withCreateTime(Long value) {
        setCreateTime(value);
        return this;
    }

    public ReservationData withCreateTime(Long value, Long defaultValue) {
        setCreateTime(value == null ? defaultValue : value);
        return this;
    }

    public Long getModifyTime() {
        return modifyTime;
    }

    public void  setModifyTime(Long value) {
        this.modifyTime = value;
    }

    public ReservationData withModifyTime(Long value) {
        setModifyTime(value);
        return this;
    }

    public ReservationData withModifyTime(Long value, Long defaultValue) {
        setModifyTime(value == null ? defaultValue : value);
        return this;
    }

    public String getNumber() {
        return number;
    }

    public void  setNumber(String value) {
        this.number = value;
    }

    public ReservationData withNumber(String value) {
        setNumber(value);
        return this;
    }

    public ReservationData withNumber(String value, String defaultValue) {
        setNumber(value == null ? defaultValue : value);
        return this;
    }

    public UID getShopUid() {
        return shopUid;
    }

    public void  setShopUid(UID value) {
        this.shopUid = value;
    }

    public ReservationData withShopUid(UID value) {
        setShopUid(value);
        return this;
    }

    public ReservationData withShopUid(UID value, UID defaultValue) {
        setShopUid(value == null ? defaultValue : value);
        return this;
    }

    public String getShopName() {
        return shopName;
    }

    public void  setShopName(String value) {
        this.shopName = value;
    }

    public ReservationData withShopName(String value) {
        setShopName(value);
        return this;
    }

    public ReservationData withShopName(String value, String defaultValue) {
        setShopName(value == null ? defaultValue : value);
        return this;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String value) {
        this.serviceName = value;
    }

    public ReservationData withServiceName(String value) {
        setServiceName(value);
        return this;
    }

    public ReservationData withServiceName(String value, String defaultValue) {
        setServiceName(value == null ? defaultValue : value);
        return this;
    }

    public Integer getPersonAmount() {
        return personAmount;
    }

    public void  setPersonAmount(Integer value) {
        this.personAmount = value;
    }

    public ReservationData withPersonAmount(Integer value) {
        setPersonAmount(value);
        return this;
    }

    public ReservationData withPersonAmount(Integer value, Integer defaultValue) {
        setPersonAmount(value == null ? defaultValue : value);
        return this;
    }

    public Long getDate() {
        return date;
    }

    public void setDate(Long value) {
        this.date = value;
    }

    public ReservationData withDate(Long value) {
        setDate(value);
        return this;
    }

    public ReservationData withDate(Long value, Long defaultValue) {
        setDate(value == null ? defaultValue : value);
        return this;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String value) {
        this.time = value;
    }

    public ReservationData withTime(String value) {
        setTime(value);
        return this;
    }

    public ReservationData withTime(String value, String defaultValue) {
        setTime(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void  setCustomerId(String value) {
        this.customerId = value;
    }

    public ReservationData withCustomerId(String value) {
        setCustomerId(value);
        return this;
    }

    public ReservationData withCustomerId(String value, String defaultValue) {
        setCustomerId(value == null ? defaultValue : value);
        return this;
    }

    public UID getCustomerUid() {
        return customerUid;
    }

    public void  setCustomerUid(UID value) {
        this.customerUid = value;
    }

    public ReservationData withCustomerUid(UID value) {
        setCustomerUid(value);
        return this;
    }

    public ReservationData withCustomerUid(UID value, UID defaultValue) {
        setCustomerUid(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void  setCustomerName(String value) {
        this.customerName = value;
    }

    public ReservationData withCustomerName(String value) {
        setCustomerName(value);
        return this;
    }

    public ReservationData withCustomerName(String value, String defaultValue) {
        setCustomerName(value == null ? defaultValue : value);
        return this;
    }

    public String getPhone() {
        return phone;
    }

    public void  setPhone(String value) {
        this.phone = value;
    }

    public ReservationData withPhone(String value) {
        setPhone(value);
        return this;
    }

    public ReservationData withPhone(String value, String defaultValue) {
        setPhone(value == null ? defaultValue : value);
        return this;
    }

    public String getRemarks() {
        return remarks;
    }

    public void  setRemarks(String value) {
        this.remarks = value;
    }

    public ReservationData withRemarks(String value) {
        setRemarks(value);
        return this;
    }

    public ReservationData withRemarks(String value, String defaultValue) {
        setRemarks(value == null ? defaultValue : value);
        return this;
    }

    public String getState() {
        return state;
    }

    public void  setState(String value) {
        this.state = value;
    }

    public ReservationData withState(String value) {
        setState(value);
        return this;
    }

    public ReservationData withState(String value, String defaultValue) {
        setState(value == null ? defaultValue : value);
        return this;
    }

    public Object getValueOf(String name) {
        switch(name) {
        case "id": return getId();
        case "createTime": return getCreateTime();
        case "modifyTime": return getModifyTime();
        case "number": return getNumber();
        case "shopUid": return getShopUid();
        case "shopName": return getShopName();
            case "serviceName":
                return getServiceName();
        case "personAmount": return getPersonAmount();
            case "date":
                return getDate();
            case "time":
                return getTime();
        case "customerId": return getCustomerId();
        case "customerUid": return getCustomerUid();
        case "customerName": return getCustomerName();
        case "phone": return getPhone();
        case "remarks": return getRemarks();
        case "state": return getState();
        }
        return null;
    }

    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }

    @Override
    public int hashCode() {
        return signature().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if(!(o instanceof ReservationData)) return false;
        return signature().equals(((ReservationData)o).signature());
    }

    public String signature() {
        throw new RuntimeException("Bean ReservationData has no signature defined, no hash code or equals possible.");
    }
}
